package com.mrdeer.common.entity.dto;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.mrdeer.common.base.Converter;
import com.mrdeer.common.entity.beans.PageEntity;
import com.mrdeer.common.entity.sys.Dict;
import lombok.*;
import lombok.experimental.Accessors;
import org.springframework.beans.BeanUtils;

@Data
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
@ToString(callSuper = false)
@EqualsAndHashCode(callSuper = true)
public class DictDTO extends Dict implements Converter<Dict, DictDTO> {
    private static final long serialVersionUID = -665500305558526192L;

    @JsonInclude(JsonInclude.Include.NON_NULL)
    private PageEntity page;

    @Override
    public void convert2Do(Dict dict) {
        BeanUtils.copyProperties(this, dict);
    }

    @Override
    public DictDTO convert(Dict dict) {
        BeanUtils.copyProperties(dict, this);
        return this;
    }
}
